

	/*-----------------------
		TABLES TEX
	------------------------*/


			*** Covid
				*** Mitigation table
				
			use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1

			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_adult], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
				
			*** Share of population
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'
		
					forvalue i=1/9 {
					replace mg0`i'=mg0`i'*100
					}
				
				*National
				forvalue i=1/9 {
				qui svy: mean mg0`i'
				local x1_mg`i'=_b[mg0`i']
				local se1_mg`i'=_se[mg0`i']
				}
				
				*Gender
				forvalue i=1/9 {
				qui svy: mean mg0`i' if ls02==1
				local x2_mg`i'=_b[mg0`i']
				local se2_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if ls02==0
				local x3_mg`i'=_b[mg0`i']
				local se3_mg`i'=_se[mg0`i']
				}
				
				*Dakar
				forvalue i=1/9 {
				qui svy: mean mg0`i' if dakar==1
				local x4_mg`i'=_b[mg0`i']
				local se4_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if dakar==0
				local x5_mg`i'=_b[mg0`i']
				local se5_mg`i'=_se[mg0`i']
				}
				
				*Location
				forvalue i=1/9 {
				qui svy: mean mg0`i' if location==1
				local x6_mg`i'=_b[mg0`i']
				local se6_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if location==2
				local x7_mg`i'=_b[mg0`i']
				local se7_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if location==3
				local x8_mg`i'=_b[mg0`i']
				local se8_mg`i'=_se[mg0`i']
				}
				
				*Education
				forvalue i=1/9 {
				qui svy: mean mg0`i' if educ==1
				local x9_mg`i'=_b[mg0`i']
				local se9_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if educ==2
				local x10_mg`i'=_b[mg0`i']
				local se10_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if educ==3
				local x11_mg`i'=_b[mg0`i']
				local se11_mg`i'=_se[mg0`i']
				}
				
				*Poverty
				forvalue i=1/9 {
				qui svy: mean mg0`i' if pov_1_90==1
				local x12_mg`i'=_b[mg0`i']
				local se12_mg`i'=_se[mg0`i']
				}
				
				forvalue i=1/9 {
				qui svy: mean mg0`i' if pov_1_90==0
				local x13_mg`i'=_b[mg0`i']
				local se13_mg`i'=_se[mg0`i']
				}
				

				clear
				set obs 13
				forvalue i=1/20{
				gen var`i'=""
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=1(2)17{
				replace var`i' = "`x`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=2(2)18{
				replace var`i' = "`se`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==19
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "La semaine dernière, vous \\ êtes-vous lavé les mains \\ avec du savon plus souvent qu’avant?" if _n==1
				replace var= "La semaine dernière, \\ avez-vous évité les poignées de \\ main / salutations physiques?" if _n==3
				replace var="La semaine dernière, \\ avez-vous porte un masque ?"  if _n==5
				replace var= "La semaine dernière, \\ avez-vous réduit le nombre de \\ visites à des amis ou à de la famille?" if _n==7
				replace var= "La semaine dernière, \\ avez-vous moins travaillé à \\ l’extérieur de la maison?" if _n==9
				replace var= "La semaine dernière, \\ vous êtes-vous ou votre famille \\ isolés des autres ?" if _n==11
				replace var= "La semaine dernière, \\ avez-vous réduit le nombre de fois que \\ vous allez au marché ou à l’épicerie?" if _n==13
				replace var= "La semaine dernière, \\ avez-vous arrêté d’aller \\ à l’église/mosquée?" if _n==15
				replace var= "La semaine dernière, \\ avez-vous évité des groupes de \\ plus de 10 personnes?" if _n==17
				replace var= "Proportion de la population" if _n==19				

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				forvalue j=2(2)18 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
			texsave v* using "$root\tex\mitigation_FR.tex", nonames replace frag  headerlines("& Nati-onal & Femme & Homme & Dakar & RDS & Cap. regionale & Autre ville & Village & Pas d'educ. & Prim-aire & Secon-daire & Pauvre & Non pauvre") nofix landscape title ("Gestes barrieres") footlines("") footnote ("Les erreurs-types sont indiquées entre parenthèses.")
				
/*------------------------------------------------------------------------------------*/	
	
					*** Contact table
					use "$root/dat/SN_2020_Covid19.dta", clear
					drop if consent==0
					drop if pilot==1
	
					* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_adult], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
					
				tab em03, gen(contact)
				ren mg10 contact5
			
			*** Share of population
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'

				forvalue i=1/4 {
				replace contact`i'=contact`i'*100
				}
				
				*National
				forvalue i=1/5 {
				qui svy: mean contact`i'
				local x1_mg`i'=_b[contact`i']
				local se1_mg`i'=_se[contact`i']
				}
				
				*Gender
				forvalue i=1/5 {
				qui svy: mean contact`i' if ls02==1
				local x2_mg`i'=_b[contact`i']
				local se2_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if ls02==0
				local x3_mg`i'=_b[contact`i']
				local se3_mg`i'=_se[contact`i']
				}
				
				*Dakar
				forvalue i=1/5 {
				qui svy: mean contact`i' if dakar==1
				local x4_mg`i'=_b[contact`i']
				local se4_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if dakar==0
				local x5_mg`i'=_b[contact`i']
				local se5_mg`i'=_se[contact`i']
				}
				
				*Location
				forvalue i=1/5 {
				qui svy: mean contact`i' if location==1
				local x6_mg`i'=_b[contact`i']
				local se6_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if location==2
				local x7_mg`i'=_b[contact`i']
				local se7_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if location==3
				local x8_mg`i'=_b[contact`i']
				local se8_mg`i'=_se[contact`i']
				}
				
				*Education
				forvalue i=1/5 {
				qui svy: mean contact`i' if educ==1
				local x9_mg`i'=_b[contact`i']
				local se9_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if educ==2
				local x10_mg`i'=_b[contact`i']
				local se10_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if educ==3
				local x11_mg`i'=_b[contact`i']
				local se11_mg`i'=_se[contact`i']
				}
				
				*Poverty
				forvalue i=1/5 {
				qui svy: mean contact`i' if pov_1_90==1
				local x12_mg`i'=_b[contact`i']
				local se12_mg`i'=_se[contact`i']
				}
				
				forvalue i=1/5 {
				qui svy: mean contact`i' if pov_1_90==0
				local x13_mg`i'=_b[contact`i']
				local se13_mg`i'=_se[contact`i']
				}
				
				/*Worker
				svy: mean contact5 if em01==1
				local x14_mg5=_b[contact5]
				local se14_mg5=_se[contact5]
				
				svy: mean contact5 if em01==0
				local x15_mg5=_b[contact5]
				local se15_mg5=_se[contact5]*/
				

				clear
				set obs 13
				forvalue i=1/13{
				gen var`i'=""
				}
				
				forvalue j=1/13 {
				local k=1
				forvalue i=1(2)9{
				replace var`i' = "`x`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
				forvalue j=1/13 {
				local k=1
				forvalue i=2(2)10{
				replace var`i' = "`se`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				order var
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==13
				local k=`k'+1			
				}
				
				gen var=""	
				replace var= "Avec combien de pers. etes-vous en \\ contact à l'extérieur de la maison?" if _n==1
				replace var= "\hspace{0.5cm} 0 a 4" if _n==2
				replace var= "\hspace{0.5cm} 5 a 9" if _n==4
				replace var= "\hspace{0.5cm} 10 a 50" if _n==6
				replace var= "\hspace{0.5cm} Plus de 50" if _n==8
				replace var= "Combien de contacts directs \\ avez-vous eus hier?" if _n==10
				replace var= "Proportion de la population" if _n==13				

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				forvalue j=3(2)11 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}

				texsave v* using "$root\tex\contact_FR.tex", nonames replace frag  headerlines ("& Nati-onal & Femme & Homme & Dakar & RDS & Cap. regionale & Autre ville & Village & Pas d'educ. & Prim-aire & Secon-daire & Pauvre & Non pauvre") nofix landscape title ("Nombre de contacts") footlines("") footnote ("Les erreurs-types sont indiquées entre parenthèses.")
				
				use "$root/dat/SN_2020_Covid19.dta", clear
					drop if consent==0
					drop if pilot==1
					drop if mg10==.
				gen xx=weight_adult*mg10
				total xx
				gen shx=xx/ 11965.14
				sum shx
				gsort -shx
				gen cum_shx=sum(shx)
				total weight_adult
				gen cum_weight=sum(weight_adult/1572.918)
				
				line cum_shx cum_weight, xtitle(Proportion of population) ytitle(Proportion of contacts) xline(.2)
				graph export "$root\tex\cumcontact.pdf", replace
				
				gen top20=(cum_weight<=.2)
				
/*------------------------------------------------------------------------------------*/	
	
					*** Income, food security and employment
					use "$root/dat/SN_2020_Covid19.dta", clear
					drop if consent==0
					drop if pilot==1
	
					* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_hh], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
				
		gen size=0 if fs011==0
		replace size=1 if fs011>0 &  fs011<4
		replace size=2 if fs011>3 &   fs011!=.
		tab size, gen(size)
		
		gen number=0 if fs012==0
		replace number=1 if fs012>0 &  fs012<4
		replace number=2 if fs012>3 &   fs012!=.
		tab number, gen(number)
					
			*** Share of population
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			qui svy: mean dakar
			local sh2=_b[dakar]*100
			local sh3=100-`sh2'
			qui svy: mean loc1
			local sh4=_b[loc1]*100
			qui svy: mean loc2
			local sh5=_b[loc2]*100
			qui svy: mean loc3
			local sh6=_b[loc3]*100
			qui svy: mean ed1
			local sh7=_b[ed1]*100
			qui svy: mean ed2
			local sh8=_b[ed2]*100
			qui svy: mean ed3
			local sh9=_b[ed3]*100
			qui svy: mean pov_1_90
			local sh10=_b[pov_1_90]*100
			local sh11=100-`sh10'

				tab fs07, gen(inc)
				forvalue i=1/3{
				local j=`i'+8
				ren inc`i' inc`j'
				}
				ren nc04 inc1
				ren em01 inc2
				local k=3
				foreach var in size number{
					forvalue i=1/3{
				ren `var'`i' inc`k'
									local k=`k'+1

					}
				}
				
				forvalue i=1/11 {
				replace inc`i'=inc`i'*100
				}

				*National
				forvalue i=1/11{
				qui svy: mean inc`i'
				local x1_mg`i'=_b[inc`i']
				local se1_mg`i'=_se[inc`i']
				}
				
				*Dakar
				forvalue i=1/11 {
				qui svy: mean inc`i' if dakar==1
				local x2_mg`i'=_b[inc`i']
				local se2_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/11 {
				qui svy: mean inc`i' if dakar==0
				local x3_mg`i'=_b[inc`i']
				local se3_mg`i'=_se[inc`i']
				}
				
				*Location
				forvalue i=1/11 {
				qui svy: mean inc`i' if location==1
				local x4_mg`i'=_b[inc`i']
				local se4_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/11 {
				qui svy: mean inc`i' if location==2
				local x5_mg`i'=_b[inc`i']
				local se5_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/11 {
				qui svy: mean inc`i' if location==3
				local x6_mg`i'=_b[inc`i']
				local se6_mg`i'=_se[inc`i']
				}
				
				*Education
				forvalue i=1/11 {
				qui svy: mean inc`i' if educ==1
				local x7_mg`i'=_b[inc`i']
				local se7_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/11 {
				qui svy: mean inc`i' if educ==2
				local x8_mg`i'=_b[inc`i']
				local se8_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/11 {
				qui svy: mean inc`i' if educ==3
				local x9_mg`i'=_b[inc`i']
				local se9_mg`i'=_se[inc`i']
				}
				
				*Poverty
				forvalue i=1/11 {
				qui svy: mean inc`i' if pov_1_90==1
				local x10_mg`i'=_b[inc`i']
				local se10_mg`i'=_se[inc`i']
				}
				
				forvalue i=1/11 {
				qui svy: mean inc`i' if pov_1_90==0
				local x11_mg`i'=_b[inc`i']
				local se11_mg`i'=_se[inc`i']
				}
								
				clear
				set obs 11
				forvalue i=1/24{
				gen var`i'=""
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=1(2)21{
				replace var`i' = "`x`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=2(2)22{
				replace var`i' = "`se`j'_mg`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
				gen vara=""
				gen varb=""
				gen varc=""
				order var1 var2 var3 var4 vara var5 var6 var7 var8 var9 var10  varb var11 var12 var13 var14 var15 var16 varc var17 
				
				sxpose, clear
								
				local k=1
				forvalue i=1/11{
				replace _var`i' = "`sh`k''" if _n==26
				local k=`k'+1			
				}
				
				gen var=""	
				replace var= "Au cours des sept derniers jours, \\ mon revenu familial total était inférieur \\ à la normale pour mon ménage" if _n==1
				replace var= "Avez-vous passé au moins \\ une heure à travailler hier?" if _n==3
				replace var= "Combien de jours avez-vous \\ ou quelqu'un de votre ménage a dû \\ limiter la taille des repas?" if _n==5
				replace var= "\hspace{0.5cm} 0 jours" if _n==6
				replace var= "\hspace{0.5cm} 1 à 3 jours" if _n==8
				replace var= "\hspace{0.5cm} 4 à 7 jours" if _n==10
				replace var= "Combien de jours avez-vous \\ ou quelqu'un de votre ménage a dû \\ réduire le nombre de repas mangés par jour?" if _n==12
				replace var= "\hspace{0.5cm} 0 jours" if _n==13
				replace var= "\hspace{0.5cm} 1 à 3 jours" if _n==15
				replace var= "\hspace{0.5cm} 4 à 7 jours" if _n==17
				replace var= "En comparaison avec le mois dernier \\ le prix du riz a" if _n==19
				replace var= "\hspace{0.5cm} Augment\'{e}" if _n==20
				replace var= "\hspace{0.5cm} Diminu\'{e}" if _n==22
				replace var= "\hspace{0.5cm} Rest\'{e} le m\^{e}me" if _n==24
				replace var= "Proportion de la population" if _n==26				

				order var
				ren _var* var*
				
				forvalue i=1/11{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var11{
				forvalue j=2(2)4 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var11{
				forvalue j=7(2)11 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var11{
				forvalue j=14(2)18 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var11{
				forvalue j=21(2)25 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}

				texsave v* using "$root\tex\income_FR.tex", nonames replace frag  headerlines("& Nati-onal & ~ Dakar & RDS & Cap. regionale & Autre ville & Village & Pas d'educ. & Prim-aire & Secon-daire & Pauvre & Non pauvre") nofix landscape title ("Revenu, emploi et sécurité alimentaire") footlines("") footnote ("Les erreurs-types sont indiquées entre parenthèses.")
				
			*** Migration
					use "$root/dat/SN_2020_Covid19.dta", clear
					drop if consent==0
					drop if pilot==1
	
					* svyset declares the post-stratifcation design using true regional weight as share. 
						svyset _n [pw=weight_adult], poststrata(strat_mig) postweight(share_mig)
						
								*** Share of population
			tab location2, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean ed1
			local sh4=_b[ed1]*100
			svy: mean ed2
			local sh5=_b[ed2]*100
			svy: mean ed3
			local sh6=_b[ed3]*100
			svy: mean pov_1_90
			local sh7=_b[pov_1_90]*100
			local sh8=100-`sh7'

			replace mi03=mi03*100
			
			*National
				qui svy: mean mi03
				local x1_mg1=_b[mi03]
				local se1_mg1=_se[mi03]
	
				*Gender
				qui svy: mean mi03 if ls02==1
				local x2_mg1=_b[mi03]
				local se2_mg1=_se[mi03]
				
				qui svy: mean mi03 if ls02==0
				local x3_mg1=_b[mi03]
				local se3_mg1=_se[mi03]
				
				*Education
				qui svy: mean mi03 if educ==1
				local x4_mg1=_b[mi03]
				local se4_mg1=_se[mi03]
				
				qui svy: mean mi03 if educ==2
				local x5_mg1=_b[mi03]
				local se5_mg1=_se[mi03]
				
				qui svy: mean mi03 if educ==3
				local x6_mg1=_b[mi03]
				local se6_mg1=_se[mi03]
				
				*Poverty
				qui svy: mean mi03 if pov_1_90==1
				local x7_mg1=_b[mi03]
				local se7_mg1=_se[mi03]
				
				qui svy: mean mi03 if pov_1_90==0
				local x8_mg1=_b[mi03]
				local se8_mg1=_se[mi03]
				
				clear
				set obs 8
				forvalue i=1/3{
				gen var`i'=""
				}
				
				forvalue j=1/8 {
				replace var1 = "`x`j'_mg1'" if _n==`j'
				local k=`k'+1
					}
	
				
				forvalue j=1/8 {
				replace var2 = "`se`j'_mg1'" if _n==`j'
					}
			
				sxpose, clear
								
				local k=1
				forvalue i=1/8{
				replace _var`i' = "`sh`k''" if _n==3
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "Résidiez-vous au m\^{e}me \\ endroit le 1er Mars?" if _n==1
				replace var= "Proportion de la population" if _n==3				

				order var
				ren _var* var*
				
				forvalue i=1/8{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var8{
					replace `v'="("+`v'+")" if _n==2
				}
				
				texsave v* using "$root\tex\migration1_FR.tex", nonames replace frag  headerlines("& National & Femme & Homme & Pas d'educ. & Primaire & Secon-daire & Pauvre & Non pauvre") nofix landscape title ("Migration") footlines("") footnote ("Les erreurs-types sont indiquées entre parenthèses.")
				
						
			*** Migration by group of region
			use "$root/dat/SN_2020_Covid19.dta", clear
					drop if consent==0
					drop if pilot==1
	
					* svyset declares the post-stratifcation design using true regional weight as share. 
						
						replace mi03=mi03*100
						tab location, gen(loc)

						
						forvalue i=1/7{
						gen r`i'=(reg_group==`i' & reg_group!=.)
						}
						
						svyset _n [pw=weight_adult], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
						
						forvalue i=1/7{
						svy:mean r`i'
						local sh`i'=_b[r]*100
						}
						
						forvalue i=1/3{
						local k=`i'+7
						svy:mean loc`i'
						local sh`k'=_b[loc]*100
						}

						forvalue i=1/7{
						svy:mean mi03 if reg_group==`i' 
						local x`i'=_b[mi03]
						local x_se`i'=_se[mi03]
						}
						
						forvalue i=1/3{
						local k=`i'+7
						svy:mean mi03 if location==`i' 
						local x`k'=_b[mi03]
						local x_se`k'=_se[mi03]
						}
						
						svyset _n [pw=weight_adult], poststrata(old_strata_reg_sex2) postweight(old_reg_sex_share2)

						forvalue i=1/7{
						qui svy:mean mi03 if old_reg_group==`i'
						local y`i'=_b[mi03]
						local y_se`i'=_se[mi03]
						}
						
						forvalue i=1/3{
						local k=`i'+7
						svy:mean mi03 if location2==`i' 
						local y`k'=_b[mi03]
						local y_se`k'=_se[mi03]
						}

					clear
					set obs 5
					
					forvalue i=1/10{
					gen var`i'=.
					replace var`i'=`x`i'' if _n==3
					replace var`i'=`x_se`i'' if _n==4
					replace var`i'=`y`i'' if _n==1
					replace var`i'=`y_se`i'' if _n==2
						replace var`i'=`sh`i'' if _n==5
					}
					
					
					gen var=""
					replace var="Déplacement de" if _n==1
					replace var="Déplacement vers" if _n==3
					replace var="Proportion" if _n==5
					
					forvalue i=1/10{
					tostring var`i', replace force
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var10{
					replace `v'="("+`v'+")" if _n==2 | _n==4
				}

				order var
					
								texsave v* using "$root\tex\migration2_FR.tex", nonames replace frag  headerlines("& Dakar & Casamance & Diourbel & North & South-East & Centre & Thiès & Reg. Capital & Other town & Village") nofix landscape title ("Migration par region") footlines("") footnote ("Les erreurs-types sont indiquées entre parenthèses." "Régions regroupées car les échantillons sont de petite taille. Casamance: Ziguinchor/Kolda/Sedhiou. Nord: Louga/Saint-Louis/Matam. Sud-Est: Tambacounda/Kédougou. Centre: Fatick/Kaolack/Kaffrine.")	
					
			
			
			*** Awarness and perception AT01, AT02, AT03, GS05
			use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1

			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_adult], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
				
			*** Share of population
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'
			
			tab at03, gen(at03_)
			tab gs05, gen(at04_)
			
			foreach v of var at02 at03{
			rename `v' `v'_a
			}
		
			local k=2
			foreach v of var at02_1 at02_2 at02_3 at02_4 at02_5 at03_1 at03_2 at03_3 at03_4 at04_1 at04_2 at04_3{
			rename `v' at0`k'
			local k=`k'+1
				}
			
		
					forvalue i=1/13 {
					replace at0`i'=at0`i'*100
					}
				
				*National
				forvalue i=1/13 {
				qui svy: mean at0`i'
				local x1_at`i'=_b[at0`i']
				local se1_at`i'=_se[at0`i']
				}
				
				*Gender
				forvalue i=1/13 {
				qui svy: mean at0`i' if ls02==1
				local x2_at`i'=_b[at0`i']
				local se2_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if ls02==0
				local x3_at`i'=_b[at0`i']
				local se3_at`i'=_se[at0`i']
				}
				
				*Dakar
				forvalue i=1/13 {
				qui svy: mean at0`i' if dakar==1
				local x4_at`i'=_b[at0`i']
				local se4_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if dakar==0
				local x5_at`i'=_b[at0`i']
				local se5_at`i'=_se[at0`i']
				}
				
				*Location
				forvalue i=1/13 {
				qui svy: mean at0`i' if location==1
				local x6_at`i'=_b[at0`i']
				local se6_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if location==2
				local x7_at`i'=_b[at0`i']
				local se7_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if location==3
				local x8_at`i'=_b[at0`i']
				local se8_at`i'=_se[at0`i']
				}
				
				*Education
				forvalue i=1/13 {
				qui svy: mean at0`i' if educ==1
				local x9_at`i'=_b[at0`i']
				local se9_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if educ==2
				local x10_at`i'=_b[at0`i']
				local se10_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if educ==3
				local x11_at`i'=_b[at0`i']
				local se11_at`i'=_se[at0`i']
				}
				
				*Poverty
				forvalue i=1/13 {
				qui svy: mean at0`i' if pov_1_90==1
				local x12_at`i'=_b[at0`i']
				local se12_at`i'=_se[at0`i']
				}
				
				forvalue i=1/13 {
				qui svy: mean at0`i' if pov_1_90==0
				local x13_at`i'=_b[at0`i']
				local se13_at`i'=_se[at0`i']
				}
				

				clear
				set obs 13
				forvalue i=1/29{
				gen var`i'=""
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=1(2)25{
				replace var`i' = "`x`j'_at`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=2(2)26{
				replace var`i' = "`se`j'_at`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				gen var_blank=""
				gen var_blankk=""
				order var, after(var2)
				order var_blank, after(var12)
				order var_blankk, after(var20)
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==31
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "Avant cet appel, aviez-vous \\ entendu parler du « coronavirus » ou covid-19" if _n==1
				replace var= "Où obtenez-vous de l’information \\ sur le coronavirus?" if _n==3
				replace var=" \hspace{0.5cm} Communication du Gouvernement"  if _n==4
				replace var=" \hspace{0.5cm} Journaux, télé, radio"  if _n==6
				replace var=" \hspace{0.5cm} Média Sociaux"  if _n==8
				replace var=" \hspace{0.5cm} Famille ou voisin"  if _n==10
				replace var=" \hspace{0.5cm} Marabouts, imam ou prêtre"  if _n==12
				replace var="A quel point êtes-vous inquiet \\ d’être infecté par le Coronavirus ?"  if _n==14
				replace var=" \hspace{0.5cm} Pas du tout inquiet"  if _n==15
				replace var=" \hspace{0.5cm} Un peu inquiet"  if _n==17
				replace var=" \hspace{0.5cm} Inquiet"  if _n==19
				replace var=" \hspace{0.5cm} Extremement inquiet"  if _n==21
				replace var="Quelle est votre principale source \\ d’inquiétude liée a la crise du Coronavirus ?"  if _n==23
				replace var=" \hspace{0.5cm} Ma santé et celle de mes proches"  if _n==24
				replace var=" \hspace{0.5cm} Manquer d'argent ou de nourriture"  if _n==26
				replace var=" \hspace{0.5cm} Je ne suis pas inquiet"  if _n==28

				replace var= "Share of population" if _n==31			

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				replace `v'="("+`v'+")" if _n==2
				}
				
				
				foreach v of varlist var1-var13{
				forvalue j=5(2)13 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				forvalue j=16(2)22 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				forvalue j=25(2)29 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				replace `v'="100" if `v'=="100."
				}
				
				
				texsave v* using "$root\tex\awareness_FR.tex", nonames replace frag  headerlines("& Nati-onal & Femme & Homme & Dakar & RDS & Cap. regionale & Autre ville & Village & Pas d'educ. & Prim-aire & Secon-daire & Pauvre & Non pauvre") nofix landscape title ("Conscience et perceptions") footlines("") footnote ("Les erreurs-types sont indiquées entre parenthèses.")
			
			/*
			*** Gvt policies GS01, GS02, GS03 & GS04
			use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1

			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_adult], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
				
			*** Share of population
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'
			
			replace gs04=0 if gs04==2
			tab gs01, gen(gs01_)
			tab gs02, gen(gs02_)
			tab gs03, gen(gs03_)
			
			foreach v of var gs01 gs02 gs03 gs05{
			rename `v' `v'_a
			}
			
			rename gs04 gs016
			local k=1
			foreach v of var gs01_1 gs01_2 gs01_3 gs01_4 gs01_5 gs02_1 gs02_2 gs02_3 gs02_4 gs02_5 gs03_1 gs03_2 gs03_3 gs03_4 gs03_5 {
			rename `v' gs0`k'
			local k=`k'+1
				}
			
		
					forvalue i=1/16 {
					replace gs0`i'=gs0`i'*100
					}
				
				*National
				forvalue i=1/16 {
				qui svy: mean gs0`i'
				local x1_gs`i'=_b[gs0`i']
				local se1_gs`i'=_se[gs0`i']
				}
				
				*Gender
				forvalue i=1/16 {
				qui svy: mean gs0`i' if ls02==1
				local x2_gs`i'=_b[gs0`i']
				local se2_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if ls02==0
				local x3_gs`i'=_b[gs0`i']
				local se3_gs`i'=_se[gs0`i']
				}
				
				*Dakar
				forvalue i=1/16 {
				qui svy: mean gs0`i' if dakar==1
				local x4_gs`i'=_b[gs0`i']
				local se4_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16{
				qui svy: mean gs0`i' if dakar==0
				local x5_gs`i'=_b[gs0`i']
				local se5_gs`i'=_se[gs0`i']
				}
				
				*Location
				forvalue i=1/16 {
				qui svy: mean gs0`i' if location==1
				local x6_gs`i'=_b[gs0`i']
				local se6_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if location==2
				local x7_gs`i'=_b[gs0`i']
				local se7_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if location==3
				local x8_gs`i'=_b[gs0`i']
				local se8_gs`i'=_se[gs0`i']
				}
				
				*Education
				forvalue i=1/16 {
				qui svy: mean gs0`i' if educ==1
				local x9_gs`i'=_b[gs0`i']
				local se9_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if educ==2
				local x10_gs`i'=_b[gs0`i']
				local se10_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if educ==3
				local x11_gs`i'=_b[gs0`i']
				local se11_gs`i'=_se[gs0`i']
				}
				
				*Poverty
				forvalue i=1/16{
				qui svy: mean gs0`i' if pov_1_90==1
				local x12_gs`i'=_b[gs0`i']
				local se12_gs`i'=_se[gs0`i']
				}
				
				forvalue i=1/16 {
				qui svy: mean gs0`i' if pov_1_90==0
				local x13_gs`i'=_b[gs0`i']
				local se13_gs`i'=_se[gs0`i']
				}
				

				clear
				set obs 13
				forvalue i=1/35{
				gen var`i'=""
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=1(2)31{
				replace var`i' = "`x`j'_gs`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=2(2)32{
				replace var`i' = "`se`j'_gs`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				gen var_blank=""
				gen var_blankk=""

				order var, before(var1)
				order var_blank, after(var10)
				order var_blankk, after(var20)
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==37
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "Pensez-vous que la réaction du gouvernement \\ de votre pays à l’épidémie actuelle de coronavirus est" if _n==1
				replace var=" \hspace{0.5cm} Trop extrême"  if _n==2
				replace var=" \hspace{0.5cm} Plutot extrême"  if _n==4
				replace var=" \hspace{0.5cm} appropriée"  if _n==6
				replace var=" \hspace{0.5cm} Plutot Insuffisante"  if _n==8
				replace var=" \hspace{0.5cm} Insuffisante"  if _n==10
				replace var="Dans quelle mesure faites-vous \\ confiance au gouvernement de votre pays pour \\ prendre soin de ses citoyens?"  if _n==12
				replace var=" \hspace{0.5cm} Tres méfiant"  if _n==13
				replace var=" \hspace{0.5cm} Plutot méfiant"  if _n==15
				replace var=" \hspace{0.5cm} Ni méfiant, ni confiant"  if _n==17
				replace var=" \hspace{0.5cm} Plutot confiant"  if _n==19
				replace var=" \hspace{0.5cm} Tres confiant"  if _n==21
				replace var="Dans quelle mesure votre gouvernement \\ a-t-il été sincère dans la description des faits \\ relatifs au coronavirus?"  if _n==23
				replace var=" \hspace{0.5cm} Tres insincère"  if _n==24
				replace var=" \hspace{0.5cm} Plutot insincère"  if _n==26
				replace var=" \hspace{0.5cm} Ni insincère, ni sincère"  if _n==28
				replace var=" \hspace{0.5cm} Plutot sincère"  if _n==30
				replace var=" \hspace{0.5cm} Tres sincère"  if _n==32
				replace var="Etes-vous favorable à un confinement \\ pour 2 semaines pour lutter contre \\ la propagation du Coronavirus?"  if _n==34
				replace var= "Proportion de la population" if _n==37			

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				forvalue j=3(2)11 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				forvalue j=14(2)22 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				forvalue j=25(2)35 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				 snapshot save, label("before changes")
				 drop if _n>22 & _n<36
				
				texsave v* using "$root\tex\government1_FR.tex", nonames replace frag  headerlines("& Nati-onal & Femme & Homme & Dakar & RDS & Cap. regionale & Autre ville & Village & Pas d'educ. & Prim-aire & Secon-daire & Pauvre & Non pauvre") nofix landscape title ("Mesures du Gouvernement") footlines("")
				
				snapshot restore 1
				keep if _n>22

				texsave v* using "$root\tex\government2_FR.tex", nonames replace frag  headerlines("& Nati-onal & Femme & Homme & Dakar & RDS & Cap. regionale & Autre ville & Village & Pas d'educ. & Prim-aire & Secon-daire & Pauvre & Non pauvre") nofix landscape title ("Mesures du Gouvernement") footlines("")
				*/
				
*** Gvt policies GS02, GS03 & GS04
			use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1

			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_adult], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
				
			*** Share of population
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'
			
			replace gs04=0 if gs04==2
			tab gs01, gen(gs01_)
			tab gs02, gen(gs02_)
			tab gs03, gen(gs03_)
			
			foreach v of var gs01 gs02 gs03 gs05{
			rename `v' `v'_a
			}
			
			rename gs04 gs016
			local k=1
			foreach v of var gs01_1 gs01_2 gs01_3 gs01_4 gs01_5 gs02_1 gs02_2 gs02_3 gs02_4 gs02_5 gs03_1 gs03_2 gs03_3 gs03_4 gs03_5 {
			rename `v' gs0`k'
			local k=`k'+1
				}
			
		
					forvalue i=6/16 {
					replace gs0`i'=gs0`i'*100
					}
				
				*National
				forvalue i=6/16 {
				qui svy: mean gs0`i'
				local x1_gs`i'=_b[gs0`i']
				local se1_gs`i'=_se[gs0`i']
				}
				
				*Gender
				forvalue i=6/16 {
				qui svy: mean gs0`i' if ls02==1
				local x2_gs`i'=_b[gs0`i']
				local se2_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if ls02==0
				local x3_gs`i'=_b[gs0`i']
				local se3_gs`i'=_se[gs0`i']
				}
				
				*Dakar
				forvalue i=6/16 {
				qui svy: mean gs0`i' if dakar==1
				local x4_gs`i'=_b[gs0`i']
				local se4_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16{
				qui svy: mean gs0`i' if dakar==0
				local x5_gs`i'=_b[gs0`i']
				local se5_gs`i'=_se[gs0`i']
				}
				
				*Location
				forvalue i=6/16 {
				qui svy: mean gs0`i' if location==1
				local x6_gs`i'=_b[gs0`i']
				local se6_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if location==2
				local x7_gs`i'=_b[gs0`i']
				local se7_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if location==3
				local x8_gs`i'=_b[gs0`i']
				local se8_gs`i'=_se[gs0`i']
				}
				
				*Education
				forvalue i=6/16 {
				qui svy: mean gs0`i' if educ==1
				local x9_gs`i'=_b[gs0`i']
				local se9_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if educ==2
				local x10_gs`i'=_b[gs0`i']
				local se10_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if educ==3
				local x11_gs`i'=_b[gs0`i']
				local se11_gs`i'=_se[gs0`i']
				}
				
				*Poverty
				forvalue i=6/16{
				qui svy: mean gs0`i' if pov_1_90==1
				local x12_gs`i'=_b[gs0`i']
				local se12_gs`i'=_se[gs0`i']
				}
				
				forvalue i=6/16 {
				qui svy: mean gs0`i' if pov_1_90==0
				local x13_gs`i'=_b[gs0`i']
				local se13_gs`i'=_se[gs0`i']
				}
				

				clear
				set obs 13
				forvalue i=1/26{
				gen var`i'=""
				}
				
					forvalue j=1/13 {
				local k=6
				forvalue i=1(2)25{
				replace var`i' = "`x`j'_gs`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
					forvalue j=1/13 {
				local k=6
				forvalue i=2(2)26{
				replace var`i' = "`se`j'_gs`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				gen var_blank=""
				gen var_blankk=""

				order var, before(var1)
				order var_blank, after(var10)
				order var_blankk, after(var22)
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==26
				local k=`k'+1			
				}
				
				gen var=""
				replace var="Dans quelle mesure faites-vous \\ confiance au gouvernement de votre \\ pays pour prendre soin de ses citoyens?"  if _n==1
				replace var=" \hspace{0.5cm} Tres méfiant"  if _n==2
				replace var=" \hspace{0.5cm} Plutot méfiant"  if _n==4
				replace var=" \hspace{0.5cm} Ni méfiant, ni confiant"  if _n==6
				replace var=" \hspace{0.5cm} Plutot confiant"  if _n==8
				replace var=" \hspace{0.5cm} Tres confiant"  if _n==10
				replace var="Dans quelle mesure votre gouvernement \\ a-t-il été sincère dans la description \\ des faits relatifs au coronavirus?"  if _n==12
				replace var=" \hspace{0.5cm} Tres insincère"  if _n==13
				replace var=" \hspace{0.5cm} Plutot insincère"  if _n==15
				replace var=" \hspace{0.5cm} Ni insincère, ni sincère"  if _n==17
				replace var=" \hspace{0.5cm} Plutot sincère"  if _n==19
				replace var=" \hspace{0.5cm} Tres sincère"  if _n==21
				replace var="Etes-vous favorable à un confinement \\ pour 2 semaines pour lutter contre \\ la propagation du Coronavirus?"  if _n==23
				replace var= "Proportion de la population" if _n==26		

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				forvalue j=3(2)11 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
				forvalue j=14(2)22 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var13{
					replace `v'="("+`v'+")" if _n==24
					
				}
				

				
				texsave v* using "$root\tex\government1_FR.tex", nonames replace frag  headerlines("& Nati-onal & Femme &Homme &~Dakar & RDS & Cap. regionale & Autre ville & Village & Pas d'educ. & Prim-aire & Secon-daire & Pauvre & Non pauvre") nofix landscape title ("Mesures du Gouvernement") footlines("") footnote ("Les erreurs-types sont indiquées entre parenthèses.")
				
				
*** Symptoms
			use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1

			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_adult], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
				
			*** Share of population
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean ls02
			local sh2=_b[ls02]*100
			local sh3=100-`sh2'
			svy: mean dakar
			local sh4=_b[dakar]*100
			local sh5=100-`sh4'
			svy: mean loc1
			local sh6=_b[loc1]*100
			svy: mean loc2
			local sh7=_b[loc2]*100
			svy: mean loc3
			local sh8=_b[loc3]*100
			svy: mean ed1
			local sh9=_b[ed1]*100
			svy: mean ed2
			local sh10=_b[ed2]*100
			svy: mean ed3
			local sh11=_b[ed3]*100
			svy: mean pov_1_90
			local sh12=_b[pov_1_90]*100
			local sh13=100-`sh12'
		
					forvalue i=1/3 {
					replace sm0`i'=sm0`i'*100
					}
				
				*National
				forvalue i=1/3 {
				qui svy: mean sm0`i'
				local x1_sm`i'=_b[sm0`i']
				local se1_sm`i'=_se[sm0`i']
				}
				
				*Gender
				forvalue i=1/3 {
				qui svy: mean sm0`i' if ls02==1
				local x2_sm`i'=_b[sm0`i']
				local se2_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if ls02==0
				local x3_sm`i'=_b[sm0`i']
				local se3_sm`i'=_se[sm0`i']
				}
				
				*Dakar
				forvalue i=1/3 {
				qui svy: mean sm0`i' if dakar==1
				local x4_sm`i'=_b[sm0`i']
				local se4_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if dakar==0
				local x5_sm`i'=_b[sm0`i']
				local se5_sm`i'=_se[sm0`i']
				}
				
				*Location
				forvalue i=1/3 {
				qui svy: mean sm0`i' if location==1
				local x6_sm`i'=_b[sm0`i']
				local se6_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if location==2
				local x7_sm`i'=_b[sm0`i']
				local se7_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if location==3
				local x8_sm`i'=_b[sm0`i']
				local se8_sm`i'=_se[sm0`i']
				}
				
				*Education
				forvalue i=1/3 {
				qui svy: mean sm0`i' if educ==1
				local x9_sm`i'=_b[sm0`i']
				local se9_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if educ==2
				local x10_sm`i'=_b[sm0`i']
				local se10_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if educ==3
				local x11_sm`i'=_b[sm0`i']
				local se11_sm`i'=_se[sm0`i']
				}
				
				*Poverty
				forvalue i=1/3 {
				qui svy: mean sm0`i' if pov_1_90==1
				local x12_sm`i'=_b[sm0`i']
				local se12_sm`i'=_se[sm0`i']
				}
				
				forvalue i=1/3 {
				qui svy: mean sm0`i' if pov_1_90==0
				local x13_sm`i'=_b[sm0`i']
				local se13_sm`i'=_se[sm0`i']
				}
				

				clear
				set obs 13
				forvalue i=1/9{
				gen var`i'=""
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=1(2)5{
				replace var`i' = "`x`j'_sm`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
					forvalue j=1/13 {
				local k=1
				forvalue i=2(2)6{
				replace var`i' = "`se`j'_sm`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				sxpose, clear
								
				local k=1
				forvalue i=1/13{
				replace _var`i' = "`sh`k''" if _n==8
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "Au cours des deux dernières semaines,\\ avez-vous eu de la fièvre?" if _n==1
				replace var= "Au cours des deux dernières semaines,\\ avez-vous eu une toux sèche?" if _n==3
				replace var="Au cours des deux dernières semaines, \\ avez-vous éprouvé des difficultés \\ à respirer / un essoufflement?"  if _n==5
				replace var= "Proportion de la population" if _n==8				

				order var
				ren _var* var*
				
				forvalue i=1/13{
					replace var`i'=substr(var`i',1,4)
				}
				
				foreach v of varlist var1-var13{
				forvalue j=2(2)26 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				texsave v* using "$root\tex\symptoms_FR.tex", nonames replace frag  headerlines("& Nati-onal & Femme & Homme & Dakar & RDS & Cap. regionale & Autre ville & Village & Pas d'educ. & Prim-aire & Secon-daire & Pauvre & Non pauvre") nofix landscape title ("Symptomes") footlines("") footnote ("Les erreurs-types sont indiquées entre parenthèses.")
				
				
			*** Education of children ED06
			use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1
			
			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_child], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
				

			*** Share of population
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean dakar
			local sh2=_b[dakar]*100
			local sh3=100-`sh2'
			svy: mean loc1
			local sh4=_b[loc1]*100
			svy: mean loc2
			local sh5=_b[loc2]*100
			svy: mean loc3
			local sh6=_b[loc3]*100
			svy: mean ed1
			local sh7=_b[ed1]*100
			svy: mean ed2
			local sh8=_b[ed2]*100
			svy: mean ed3
			local sh9=_b[ed3]*100
			svy: mean pov_1_90
			local sh10=_b[pov_1_90]*100
			local sh11=100-`sh10'
			
			gen ed08=(ed06=="2" | ed06=="2 -7" | ed06=="1" & ed06!="")

			drop ed06__7
			drop ed01-ed06
		
		
			local k=1
			foreach v of var ed06_1 ed06_2 ed06_3 ed06_4 ed06_5 ed06_6 ed06_7{
			rename `v' ed0`k'
			local k=`k'+1
				}
					forvalue i=1/8 {
					replace ed0`i'=ed0`i'*100
					}
				
				*National
				forvalue i=1/8 {
				qui svy: mean ed0`i'
				local x1_ed`i'=_b[ed0`i']
				local se1_ed`i'=_se[ed0`i']
				}
								
				*Dakar
				forvalue i=1/8 {
				qui svy: mean ed0`i' if dakar==1
				local x2_ed`i'=_b[ed0`i']
				local se2_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if dakar==0
				local x3_ed`i'=_b[ed0`i']
				local se3_ed`i'=_se[ed0`i']
				}
				
				*Location
				forvalue i=1/8 {
				qui svy: mean ed0`i' if location==1
				local x4_ed`i'=_b[ed0`i']
				local se4_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if location==2
				local x5_ed`i'=_b[ed0`i']
				local se5_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if location==3
				local x6_ed`i'=_b[ed0`i']
				local se6_ed`i'=_se[ed0`i']
				}
				
				*Education
				forvalue i=1/8 {
				qui svy: mean ed0`i' if educ==1
				local x7_ed`i'=_b[ed0`i']
				local se7_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if educ==2
				local x8_ed`i'=_b[ed0`i']
				local se8_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if educ==3
				local x9_ed`i'=_b[ed0`i']
				local se9_ed`i'=_se[ed0`i']
				}
				
				*Poverty
				forvalue i=1/8 {
				qui svy: mean ed0`i' if pov_1_90==1
				local x10_ed`i'=_b[ed0`i']
				local se10_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/8 {
				qui svy: mean ed0`i' if pov_1_90==0
				local x11_ed`i'=_b[ed0`i']
				local se11_ed`i'=_se[ed0`i']
				}
				
				clear
				set obs 11
				forvalue i=1/17{
				gen var`i'=""
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=1(2)15{
				replace var`i' = "`x`j'_ed`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=2(2)16{
				replace var`i' = "`se`j'_ed`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				order var
			
				sxpose, clear
								
				local k=1
				forvalue i=1/11{
				replace _var`i' = "`sh`k''" if _n==18
				local k=`k'+1			
				}
				
				gen var=""
				replace var="Quelles activités éducatives poursuivent \\ les enfants depuis que les écoles sont fermées ?"  if _n==1
				replace var=" \hspace{0.5cm} Aucune"  if _n==2
				replace var=" \hspace{0.5cm} Etudient seuls"  if _n==4
				replace var=" \hspace{0.5cm} Exercices donnés par les parents"  if _n==6
				replace var=" \hspace{0.5cm} Exercices donnés par le maitre"  if _n==8
				replace var=" \hspace{0.5cm} Emissions éducatives a la télé ou radio"  if _n==10
				replace var=" \hspace{0.5cm} Cours en ligne"  if _n==12
				replace var=" \hspace{0.5cm} Educateur"  if _n==14
				replace var=" \hspace{0.5cm} N'étudie pas ou étudie seul"  if _n==16
				replace var= "Proportion de la population" if _n==18		
			

				order var
				ren _var* var*
				
				forvalue i=1/11{
					replace var`i'=substr(var`i',1,4)
				}
				
				
				foreach v of varlist var1-var11{
				forvalue j=3(2)17 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
								
				foreach v of varlist var1-var11{
				replace `v'="100" if `v'=="100."
				}
				
				texsave v* using "$root\tex\education_FR.tex", nonames replace frag  headerlines("& Nati-onal & Dakar & RDS & Cap. regionale & Autre ville & Village & Pas d'educ. & Prim-aire & Secon-daire & Pauvre & Non pauvre") nofix landscape title ("Education") footlines("") footnote ("Les erreurs-types sont indiquées entre parenthèses.")
				
			*** Child time use ED07a, ED07b
						use "$root/dat/SN_2020_Covid19.dta", clear
			drop if consent==0
			drop if pilot==1
			
			* svyset declares the post-stratifcation design using true regional weight as share. 
				svyset _n [pw=weight_child], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
				
			*** Share of population (\%)
			tab location, gen(loc)
			tab educ, gen(ed)
			
			local sh1=100
			svy: mean dakar
			local sh2=_b[dakar]*100
			local sh3=100-`sh2'
			svy: mean loc1
			local sh4=_b[loc1]*100
			svy: mean loc2
			local sh5=_b[loc2]*100
			svy: mean loc3
			local sh6=_b[loc3]*100
			svy: mean ed1
			local sh7=_b[ed1]*100
			svy: mean ed2
			local sh8=_b[ed2]*100
			svy: mean ed3
			local sh9=_b[ed3]*100
			svy: mean pov_1_90
			local sh10=_b[pov_1_90]*100
			local sh11=100-`sh10'
			
			drop ed01-ed04 ed06*
			ren ed05 ed05a
			
			tab ed07a, gen(ed0)
			forvalue i=1/7{
			local k=`i'+7
			ren ed0`i' ed0`k'
			}
			
			tab ed05a if ed05a<8, gen(ed0)
	
		
				forvalue i=1/14 {
					replace ed0`i'=ed0`i'*100
					}
				
				*National
				forvalue i=1/14 {
				qui svy: mean ed0`i'
				local x1_ed`i'=_b[ed0`i']
				local se1_ed`i'=_se[ed0`i']
				}
						
				*Dakar
				forvalue i=1/14 {
				qui svy: mean ed0`i' if dakar==1
				local x2_ed`i'=_b[ed0`i']
				local se2_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if dakar==0
				local x3_ed`i'=_b[ed0`i']
				local se3_ed`i'=_se[ed0`i']
				}
				
				*Location
				forvalue i=1/14 {
				qui svy: mean ed0`i' if location==1
				local x4_ed`i'=_b[ed0`i']
				local se4_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if location==2
				local x5_ed`i'=_b[ed0`i']
				local se5_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if location==3
				local x6_ed`i'=_b[ed0`i']
				local se6_ed`i'=_se[ed0`i']
				}
				
				*Education
				forvalue i=1/14 {
				qui svy: mean ed0`i' if educ==1
				local x7_ed`i'=_b[ed0`i']
				local se7_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if educ==2
				local x8_ed`i'=_b[ed0`i']
				local se8_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if educ==3
				local x9_ed`i'=_b[ed0`i']
				local se9_ed`i'=_se[ed0`i']
				}
				
				*Poverty
				forvalue i=1/14 {
				qui svy: mean ed0`i' if pov_1_90==1
				local x10_ed`i'=_b[ed0`i']
				local se10_ed`i'=_se[ed0`i']
				}
				
				forvalue i=1/14 {
				qui svy: mean ed0`i' if pov_1_90==0
				local x11_ed`i'=_b[ed0`i']
				local se11_ed`i'=_se[ed0`i']
				}
				
				clear
				set obs 11
				forvalue i=1/31{
				gen var`i'=""
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=1(2)27{
				replace var`i' = "`x`j'_ed`k''" if _n==`j'
				local k=`k'+1
					}
				}
				
				forvalue j=1/11 {
				local k=1
				forvalue i=2(2)28{
				replace var`i' = "`se`j'_ed`k''" if _n==`j'
				local k=`k'+1
					}
				}
			
				gen var=""
				gen var_blank=""
				order var, before(var1)
				order var_blank, after(var14)
			
				sxpose, clear
								
				local k=1
				forvalue i=1/11{
				replace _var`i' = "`sh`k''" if _n==31
				local k=`k'+1			
				}
				
				gen var=""
				replace var= "Alors que les écoles sont fermées, \\ qui s'occupe des enfants?" if _n==1
				replace var=" \hspace{0.5cm} Moi"  if _n==2
				replace var=" \hspace{0.5cm} Autre parent"  if _n==4
				replace var=" \hspace{0.5cm} Grand-parents"  if _n==6
				replace var=" \hspace{0.5cm} Famille élargie"  if _n==8
				replace var=" \hspace{0.5cm} Les enfants se surveillent eux-memes"  if _n==10
				replace var=" \hspace{0.5cm} Mère ou père"  if _n==12
				replace var=" \hspace{0.5cm} Les deux parents"  if _n==14
				replace var= "Pouvez-vous indiquer les deux \\ activités des enfants pendant \\ la journée (1ère)" if _n==16
				replace var=" \hspace{0.5cm} Rester a la maison pour étudier"  if _n==17
				replace var=" \hspace{0.5cm} Rester a la maison pour aider"  if _n==19
				replace var=" \hspace{0.5cm} Rester a la maison pour jouer"  if _n==21
				replace var=" \hspace{0.5cm} Joue dehors"  if _n==23
				replace var=" \hspace{0.5cm} Travaille a l'extérieur"  if _n==25
				replace var=" \hspace{0.5cm} Reste a la maison pour \\\hspace{0.5cm} étudier la Bible ou Coran"  if _n==27
				replace var=" \hspace{0.5cm} Autre"  if _n==29
				replace var= "Proportion de la population (\%)" if _n==31		
			
				order var
				ren _var* var*
				
				forvalue i=1/11{
					replace var`i'=substr(var`i',1,4)
				}
					
				foreach v of varlist var1-var11{
				forvalue j=3(2)15 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				foreach v of varlist var1-var11{
				forvalue j=18(2)30 {
					replace `v'="("+`v'+")" if _n==`j'
					}
				}
				
				
				foreach v of varlist var1-var11{
				replace `v'="100" if `v'=="100."
				}
				
				
				texsave v* using "$root\tex\time_use_FR.tex", nonames replace frag  headerlines("& Nati-onal & Dakar & RDS & Cap. regionale & Autre ville & Village & Pas d'educ. & Prim-aire & Secon-daire & Pauvre & Non pauvre") nofix landscape title ("Prise en charge des enfants et gestion du temps") footlines("") footnote ("Les erreurs-types sont indiquées entre parenthèses.")
			
			
						*Graph cumulative number of contacts
				use "$root/dat/SN_2020_Covid19.dta", clear
					drop if consent==0
					drop if pilot==1
					drop if mg10==.
				gen xx=weight_adult*mg10
				total xx
				gen shx=xx/ 11965.14
				sum shx
				gsort -shx
				gen cum_shx=sum(shx)
				total weight_adult
				gen cum_weight=sum(weight_adult/1572.918)
				
				line cum_shx cum_weight, xtitle(Proportion de la population) ytitle(Proportion des contacts) xline(.2)
				graph export "$root\tex\cumcontact_FR.pdf", replace
				
				gen top20=(cum_weight<=.2)
				
				
					
	*** Representativeness of sample
	
	use "$root/dat/SN_2020_Covid19.dta", clear
	drop if consent==0
	drop if pilot==1
	
	forvalue i=1/14{
	gen region`i'=(mi01==`i')
	}
	
	replace ls03=80 if ls03>80 & ls03!=. // Census of Senegal put together people aged 80+
	gen age_male=ls03 if ls02==0
	gen age_female=ls03 if ls02==1
	tab ls04 if ls02==0 & ls04>0 , gen(educ_male)
	tab ls04 if ls02==1 & ls04>0 , gen(educ_female)
	gen capital=(location2==1 & location2!=.)
	
	foreach var of varlist ls02 educ_male* educ_female* region1-region14 capital pov*{
	replace `var'=`var'*100
	}
	
	*Unstratified and unweighted
	
	local i=1
	foreach var of varlist ls02	age_male age_female educ_male* educ_female*{
	qui mean `var' 
	local b`i'=_b[`var']
	local se`i'=_se[`var']
	local i=`i'+1
	}		

	local i=12
	foreach var of varlist region1-region14 capital pov*{
	qui mean `var' 
	local b`i'=_b[`var']
	local i=`i'+1
	}	
	
	local b_se=0
	forvalue i=1/11{
	local b_se=`se`i''+`b_se'
	}
	local b_se=`b_se'/11
	
	* Stratified
	
	svyset _n , poststrata(mi01) postweight(region_share)
	
	local i=1
	foreach var of varlist ls02	age_male age_female educ_male* educ_female*{
	qui svy: mean `var' 
	local un`i'=_b[`var']
	local se`i'=_se[`var']
	local i=`i'+1
	}		

	local i=12
	foreach var of varlist region1-region14 capital pov*{
	qui svy: mean `var' 
	local un`i'=_b[`var']
	local i=`i'+1
	}	
	
	local un_se=0
	forvalue i=1/11{
	local un_se=`se`i''+`un_se'
	}
	local un_se=`un_se'/11
	
	* Stratified + weighted
	
	svyset _n [pw=weight_adult], poststrata(mi01) postweight(region_share)
	
	local i=1
	foreach var of varlist ls02	age_male age_female educ_male* educ_female*{
	qui svy: mean `var' 
	local x`i'=_b[`var']
	local se`i'=_se[`var']
	local i=`i'+1
	}		

	svyset _n [pw=weight_hh], poststrata(mi01) postweight(region_share)

	local i=12
	foreach var of varlist region1-region14 capital pov*{
	qui svy: mean `var' 
	local x`i'=_b[`var']
	local i=`i'+1
	}
	
	local x_se=0
	forvalue i=1/11{
	local x_se=`se`i''+`x_se'
	}
	local x_se=`x_se'/11
	
	* Not imputed
	
	svyset _n [pw=weight_adult2], poststrata(mi01) postweight(region_share)
	
	local i=1
	foreach var of varlist ls02	age_male age_female educ_male* educ_female*{
	qui svy: mean `var' 
	local i`i'=_b[`var']
	local se`i'=_se[`var']
	local i=`i'+1
	}		

	svyset _n [pw=weight_hh2], poststrata(mi01) postweight(region_share)

	local i=12
	foreach var of varlist region1-region14 capital pov*{
	qui svy: mean `var' 
	local i`i'=_b[`var']
	local i=`i'+1
	}	
	
	local i_se=0
	forvalue i=1/11{
	local i_se=`se`i''+`i_se'
	}
	local i_se=`i_se'/11
	
	* Regions grouped
	
	svyset _n [pw=weight_adult], poststrata(reg_group) postweight(region_share2)
	
	local i=1
	foreach var of varlist ls02	age_male age_female educ_male* educ_female*{
	qui svy: mean `var' 
	local rg`i'=_b[`var']
	local se`i'=_se[`var']
	local i=`i'+1
	}		

	svyset _n [pw=weight_hh], poststrata(reg_group) postweight(region_share2)

	local i=12
	foreach var of varlist region1-region14 capital pov*{
	qui svy: mean `var' 
	local rg`i'=_b[`var']
	local i=`i'+1
	}	
	
	local rg_se=0
	forvalue i=1/11{
	local rg_se=`se`i''+`rg_se'
	}
	local rg_se=`rg_se'/11
	
		* Regions grouped + sex
	
	svyset _n [pw=weight_adult], poststrata(strata_reg_sex2) postweight(reg_sex_share2)
	
	local i=1
	foreach var of varlist ls02	age_male age_female educ_male* educ_female*{
	qui svy: mean `var' 
	local rgs`i'=_b[`var']
	local se`i'=_se[`var']
	local i=`i'+1
	}		

	svyset _n [pw=weight_hh], poststrata(strata_reg_sex2) postweight(reg_sex_share2)

	local i=12
	foreach var of varlist region1-region14 capital pov*{
	qui svy: mean `var' 
	local rgs`i'=_b[`var']
	local i=`i'+1
	}	
	
	local rgs_se=0
	forvalue i=1/11{
	local rgs_se=`se`i''+`rgs_se'
	}
	local rgs_se=`rgs_se'/11
	
	clear
	set obs 30
	
	gen var1=""
	local i=1
	foreach x in "Part des femmes" "Âge des hommes" "Âge des femmes" "Pas d'éducation (hommes)" "Éducation primaire (hommes)" "Éducation secondaire (hommes)" "Éducation tertiaire (hommes)" "Pas d'éducation (femmes)" "Éducation primaire (femmes)" "Éducation secondaire (femmes)" "Éducation tertiaire (femmes)" "Dakar" "Ziguinchor" "Diourbel" "Saint-Louis" "Tambacounda" "Kaolack" "Thies" "Louga" "Fatick" "Kolda" "Matam" "Kaffrine" "Kédougou" "Sédhiou" "Vivre dans la capitale régionale" "Pauvreté 1,90$ (2011)" "Pauvreté 3,2$ (2011)" "Pauvreté 5,5$ (2011)" "Moyenne écart-types"{
	replace var1="`x'" if _n==`i'
	local i=`i'+1
	}
	
	gen var3=""
	local i=1
	foreach x in "51.4" "36.6" "37.1"  "49.6" "19.2" "23.8" "7.4" "60" "18.2" "18" "3.8" "23.1" "4.1" "11.1" "6.6" "5.2" "7.1" "13" "6.4" "5.3" "4.9" "4.3" "4.3" "1.1" "3.4" "19.6" "38""68" "88"{
	replace var3="`x'" if _n==`i'
	local i=`i'+1
	}
	
	gen var2=""
	local i=1
	forvalue i=1/29{
	replace var2="`b`i''" if _n==`i'
	local i=`i'+1
	}
	replace var2="`b_se'" if _n==30
	
	
	gen var4=""
	local i=1
	forvalue i=1/29{
	replace var4="`x`i''" if _n==`i'
	local i=`i'+1
	}
	replace var4="`x_se'" if _n==30

	
	gen var5=""
	local i=1
	forvalue i=1/29{
	replace var5="`un`i''" if _n==`i'
	local i=`i'+1
	}
	replace var5="`un_se'" if _n==30

	
	gen var6=""
	local i=1
	forvalue i=1/29{
	replace var6="`i`i''" if _n==`i'
	local i=`i'+1
	}
	replace var6="`i_se'" if _n==30

	gen var7=""
	local i=1
	forvalue i=1/29{
	replace var7="`rg`i''" if _n==`i'
	local i=`i'+1
	}
	replace var7="`rg_se'" if _n==30
	
	gen var8=""
	local i=1
	forvalue i=1/29{
	replace var8="`rgs`i''" if _n==`i'
	local i=`i'+1
	}
	replace var8="`rgs_se'" if _n==30

	replace var2=substr(var2,1, 4)
	replace var4=substr(var4,1, 4)
	replace var5=substr(var5,1, 4)
	replace var6=substr(var6,1, 4)
	replace var7=substr(var7,1, 4)
	replace var8=substr(var8,1, 4)
	
		texsave  var1 var2 var8 var3 using "$root/tex/sample_FR",nonames replace frag title ("Représentativité de l'échantillon") nofix headerlines("Variables & Non-pondéré & Pondéré + Post-stratifié & Statistiques Nationales ") footnote ("Source des données des statistiques nationales: \begin{itemize} \item ANSD, 2018: part des femmes, age homme/femme et régions \item DHS, 2017: éducation homme/femme \item RGPHAE, 2013: Vivre dans une capital régionale \item Banque Mondiale, 2011: Taux de pauvreté \end{itemize}")


